package com.litbw.testfiles;

import static org.junit.Assert.*;

import org.junit.Test;

import com.litbw.user.DataValidator;
/**
 * @author Derrick Mink
 */
public class DataValidatorTest {

	@Test
	public void testIsValidPassword() {
		assertFalse(DataValidator.isValidPassword("1234"));
		assertTrue(DataValidator.isValidPassword("1qa@WS!QA@WS"));
		assertFalse(DataValidator.isValidPassword("abcdefghijkl"));
	}

	@Test
	public void testIsValidEmail() {
		assertTrue(DataValidator.isValidEmail("derrick.mink@gmail.com"));
		assertFalse(DataValidator.isValidEmail("derrick.mink@@gmail.com"));
		assertFalse(DataValidator.isValidEmail("reg3141g"));
		assertFalse(DataValidator.isValidEmail("derr2"));
	}

	@Test
	public void testIsValidPhone() {
		assertTrue(DataValidator.isValidPhone("(253) 572-2159"));
		assertTrue(DataValidator.isValidPhone("253-576-2159"));
		assertTrue(DataValidator.isValidPhone("2535762159"));
		assertTrue(DataValidator.isValidPhone("1234567890"));
		assertTrue(DataValidator.isValidPhone("(242)(232) (2321)"));
		assertFalse(DataValidator.isValidPhone("wq231r3"));
	}

	@Test
	public void testIsValidLast() {
		assertTrue(DataValidator.isValidLast("Mink"));
		assertFalse(DataValidator.isValidLast("Mink99"));

		assertTrue(DataValidator.isValidLast("Mc-Daniel"));
		assertTrue(DataValidator.isValidLast("Mc Daniel"));
	}

	@Test
	public void testIsValidFirst() {
		assertTrue(DataValidator.isValidFirst("Derrick"));
		assertFalse(DataValidator.isValidFirst("MC-Derrick"));
		assertTrue(DataValidator.isValidFirst("abcdef"));
		assertTrue(DataValidator.isValidFirst("ABCDEF"));
	}

	@Test
	public void testIsValidAddress() {
		assertTrue(DataValidator.isValidAddress("2231 I ST NE"));
		assertTrue(DataValidator.isValidAddress("2231 I ST. NE."));
		assertTrue(DataValidator.isValidAddress("2231 I STREET NORTH"));
		assertTrue(DataValidator.isValidAddress("PO BOX 1234"));
	}

	@Test
	public void testIsValidCity() {
		assertFalse(DataValidator.isValidCity("Auburn Puyallap Tacoma"));
		assertTrue(DataValidator.isValidCity("San Francisco"));
		assertTrue(DataValidator.isValidCity("Auburn"));
		assertFalse(DataValidator.isValidCity("Tacoma66"));	
	}

	@Test
	public void testIsValidState() {
		assertTrue(DataValidator.isValidState("New York"));
		assertTrue(DataValidator.isValidState("Washington"));
		assertTrue(DataValidator.isValidState("WA"));
		assertFalse(DataValidator.isValidState("WA9"));		
	}

	@Test
	public void testIsValidZip() {
		assertTrue(DataValidator.isValidZip("98002-0000"));		
		assertTrue(DataValidator.isValidZip("98002"));		
		assertFalse(DataValidator.isValidZip("1234567"));		
	}

}
